<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr =[1,1,1,1,2,3,4,5,6,6,6,6];
        let arr2 = [3,4,5,6,7,8,9];

        // 差集 - 
        // filter 返回的值 要筛选 没有的部分 false 放到数组里。
        // arr.filter((item)=>{
        //     return !arr2.includes(item);
        // })

        // Array.form(1,2,3);
        // arr[] 集合
        

        // 差集
        // let arr3 = arr.filter(item=>!arr2.includes(item));

        let s1 = arr.filter(item=>!arr2.includes(item))

        let arr3 = [...new Set(s1)];

        console.log(arr3); //[1, 2]

        // let arr4 = arr2.filter(item=>!arr.includes(item));

        let arr4 = [...new Set(arr2.filter(item=>!arr.includes(item)))];
        
        // console.log(arr4); //[7, 8, 9]


    </script>
</body>
</html>